package me.zhengjie.modules.easycode.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author guoqing
 * @date 2021-06-17
 */
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("ec_project_tmg")
public class ProjectTmg implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer projectTmgId;

    @ApiModelProperty(value = "项目id")
    @NotNull
    private Integer projectId;

    @ApiModelProperty(value = "类型映射器组id")
    @NotNull
    private Integer typeMapperGroupId;

    public void copyFrom(ProjectTmg source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public ProjectTmg(Integer projectId, Integer typeMapperGroupId) {
        this.projectId = projectId;
        this.typeMapperGroupId = typeMapperGroupId;
    }
}
